home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / utils / file / managers / mc-3.2 / mc-3 / mc-3.2.1 / src / dir.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-17  |  2.2 KB  |  73 lines

  1. #ifndef __DIR_H
  2. #define __DIR_H
  3.  
  4. #define MIN_FILES 128
  5. #define RESIZE_STEPS 128
  6.  
  7. typedef struct {
  8.  
  9.     /* File attributes */
  10.  
  11.     int  fnamelen;
  12.     char *fname;
  13.     struct stat  buf;
  14.  
  15.     /* Flags */
  16.     struct { 
  17.     unsigned int marked:1;        /* File marked in pane window */
  18.     unsigned int exists:1;        /* Use for rereading file */
  19.     unsigned int link_to_dir:1;    /* If this is a link, does it point to directory? */
  20.     unsigned int stalled_link:1;    /* If this is a symlink and points to Charon's land */
  21.     } f;
  22.     char *cache;
  23. } file_entry;
  24.  
  25. typedef struct {
  26.     file_entry *list;
  27.     int         size;
  28. } dir_list;
  29.  
  30. typedef int sortfn (const void *, const void *);
  31. int do_load_dir (dir_list *list, sortfn *sort, int reverse, int case_sensitive, char *filter);
  32. void do_sort (dir_list *list, sortfn *sort, int top, int reverse, int case_sensitive);
  33. dir_list *do_collect_stat (dir_list *dir, int top);
  34. int do_reload_dir (dir_list *list, sortfn *sort, int count, int reverse, int case_sensitive, char *filter);
  35. void clean_dir (dir_list *list, int count);
  36. int set_zero_dir (dir_list *list);
  37.  
  38. #ifdef DIR_H_INCLUDE_HANDLE_DIRENT
  39. int handle_dirent (dir_list *list, char *filter, struct dirent *dp,
  40.            struct stat *buf1, int next_free, int *link_to_dir, int *stalled_link);
  41. #endif
  42.  
  43. /* Sorting functions */
  44. int unsorted (const file_entry *a, const file_entry *b);
  45. int sort_name (const file_entry *a, const file_entry *b);
  46. int sort_ext (const file_entry *a, const file_entry *b);
  47. int sort_time (const file_entry *a, const file_entry *b);
  48. int sort_atime (const file_entry *a, const file_entry *b);
  49. int sort_ctime (const file_entry *a, const file_entry *b);
  50. int sort_size (const file_entry *a, const file_entry *b);
  51. int sort_inode (const file_entry *a, const file_entry *b);
  52.  
  53. #define SORT_TYPES 8
  54. typedef struct {
  55.     char    *sort_name;
  56.     int     (*sort_fn)(const file_entry *, const file_entry *);
  57. } sort_orders_t;
  58.  
  59. extern sort_orders_t sort_orders [SORT_TYPES];
  60.  
  61. int link_isdir (file_entry *);
  62. int if_link_is_exe (file_entry *file);
  63.  
  64. extern int show_backups;
  65. extern int show_dot_files;
  66. extern int show_backups;
  67. extern int mix_all_files;
  68.  
  69. char   *sort_type_to_name (sortfn *);
  70. sortfn *sort_name_to_type (char *type);
  71.  
  72. #endif    /* __DIR_H */
  73.